﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using LiveSSOForDotNet.Data;

namespace LiveSSOForDotNet.Business
{
	
	public class Users
	{

        public Users()
		{}
        public bool InsertUsers(string userID, string email, string windowsLiveID)
        {
            DB_Users users = new DB_Users();
            return users.InsertUsers(userID, email, windowsLiveID);
        }
        public bool ExistsWindwsLiveID(string windowsLiveID)
        {
            DB_Users users = new DB_Users();
            DataSet dsUsers = users.SelectUserByWindowsLiveID(windowsLiveID);
            DataTable dtUsers=dsUsers.Tables[0];
            bool exists = false;
            if (dtUsers.Rows.Count > 0)
            {
                exists = true;
            }

            return exists;
        }

        public string GetUsers(string windowsLiveID)
        {
            DB_Users users = new DB_Users();
            DataSet dsUsers = users.SelectUserByWindowsLiveID(windowsLiveID);
            DataTable dtUsers = dsUsers.Tables[0];
            string userID = "";
            if (dtUsers.Rows.Count > 0)
            {
                userID = dtUsers.Rows[0]["UserID"].ToString();
            }

            return userID;
        }
	}
	
}